<template>
  <div class="renting_house">
    <div>
      <house-title :title="title"></house-title>
    </div>
    <div :class="{list_content_fixed:listContentFixed === true}">
      <top-select :getBuildList="getRentingList" :formData="formData" :buildSel="buildSel"></top-select>
    </div>
    <!--<div>-->
      <!--<list-label></list-label>-->
    <!--</div>-->
    <div>
      <renting-list v-if="rentingData" :houseListData="rentingData"></renting-list>
    </div>
  </div>
</template>

<script>
  import HouseTitle from '../../components/house/HouseTitle'
  import TopSelect from '../../components/renting/TopSelect';
  // import ListLabel from '../../components/house/ListLabel';
  import RentingList from '../../components/listComponents/RentingList';
  export default {
    name: 'RentingHouse',
    data() {
      return {
        title: '租房',
        listContentFixed: false,
        pushName:'RentingHouseDetails',
        buildSel:{
          "area":[
            {
              "CODE":"460101",
              "region_name_c":"市辖区"
            },
            {
              "CODE":"460105",
              "region_name_c":"秀英区"
            },
            {
              "CODE":"460106",
              "region_name_c":"龙华区"
            },
            {
              "CODE":"460107",
              "region_name_c":"琼山区"
            },
            {
              "CODE":"460108",
              "region_name_c":"美兰区"
            }
          ],
          "price":[
            {
              "value":"0-100",
              "title":"100元以下"
            },
            {
              "value":"100-200",
              "title":"100-200元"
            },
            {
              "value":"200-300",
              "title":"200-300元"
            },
            {
              "value":"300-500",
              "title":"300-500元"
            },
            {
              "value":"500-800",
              "title":"500-800元"
            },
            {
              "value":"800-1500",
              "title":"800-1500元"
            },
            {
              "value":"1500",
              "title":"1500元以上"
            }
          ],
          "ht_room_num":[
            {
              "id":1,
              "title":"一室",
              "value":"1"
            },
            {
              "id":2,
              "title":"二室",
              "value":"2"
            },
            {
              "id":3,
              "title":"三室",
              "value":"3"
            },
            {
              "id":4,
              "title":"四室",
              "value":"4"
            },
            {
              "id":5,
              "title":"五室",
              "value":"5"
            }
          ],
          "houseType":[
            {
              "id":1,
              "title":"公寓",
              "params":"type_is_apartment"
            },
            {
              "id":2,
              "title":"洋房",
              "params":"type_is_ocean"
            },
            {
              "id":3,
              "title":"别墅",
              "params":"type_is_villa"
            },
            {
              "id":4,
              "title":"商铺",
              "params":"type_is_shops"
            },
            {
              "id":5,
              "title":"写字楼",
              "params":"type_is_office"
            },
            {
              "id":6,
              "title":"酒店",
              "params":"type_is_hotel"
            },
            {
              "id":7,
              "title":"住宅",
              "params":"type_is_housing"
            }
          ],
          "houseAge":[
            {
              "id":1,
              "title":"2年内",
              "params":"2016-2018"
            },
            {
              "id":2,
              "title":"2-5年内",
              "params":"2016-2013"
            },
            {
              "id":3,
              "title":"5-10年内",
              "params":"2013-2008"
            },
            {
              "id":4,
              "title":"10年内",
              "params":"2008-2018"
            }
          ],
          "floorPosition":[
            {
              "id":1,
              "title":"低楼层",
              "params":"1-2"
            },
            {
              "id":2,
              "title":"中楼层",
              "params":"3-4"
            },
            {
              "id":3,
              "title":"高楼层",
              "params":"5-30"
            },
            {
              "id":4,
              "title":"顶层",
              "params":"1"
            }
          ],
          "HouseOrientation":[
            {
              "id":1,
              "title":"东",
              "params":"1"
            },
            {
              "id":2,
              "title":"南",
              "params":"2"
            },
            {
              "id":3,
              "title":"西",
              "params":"3"
            },
            {
              "id":4,
              "title":"北",
              "params":"4"
            },
            {
              "id":5,
              "title":"东西",
              "params":"5"
            },
            {
              "id":6,
              "title":"南北",
              "params":"6"
            },
            {
              "id":7,
              "title":"东南",
              "params":"7"
            },
            {
              "id":8,
              "title":"东北",
              "params":"8"
            },
            {
              "id":9,
              "title":"西南",
              "params":"9"
            },
            {
              "id":10,
              "title":"西北",
              "params":"10"
            }
          ]
        },
        formData:{},
        rentingData:[
          {
            "id":84,
            "city_code":4601,
            "developer":"广汉市宏跃商贸有限公司",
            "area_code":460109,
            "title":null,
            "all_floor":null,
            "labels":['合租','南北通透','押一付一'],
            "sell":3000,
            "sell_average":30000,
            "building_year":2018,
            "ht_room_num":3,
            "ht_office_num":3,
            "in_acreage":null,
            "acreage":97,
            "name":"海甸上苑",
            "file":{
              "save_path":'https://kf.wuyoufang.cn/upload/premises/20180808/247a80b0e7686844e00ab0dafff823db.jpg'
            },
            "floor":{
              "title":"低层"
            },
            "area":{
              "region_name_c":"海口市"
            }
          }
        ]
      }
    },
    methods: {
      getRentingList(){

      },
      handleScroll() {
        // let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
        let scrollTop = window.pageYOffset;
        // console.log(scrollTop);
        // let offsetTop = document.getElementsByTagName('.two_house_content').offsetTop;
        if (scrollTop > 50) {
          this.listContentFixed = true
        } else {
          this.listContentFixed = false
        }
      }
    },
    mounted() {
      window.addEventListener('scroll', this.handleScroll)
    },
    components: {
      RentingList,
      // ListLabel,
      HouseTitle,
      TopSelect
    }
  }
</script>

<style scoped>
  .renting_house .list_content_fixed{
    position: fixed;
    left: 0;
    top: 0;
    z-index: 9;
    background-color: #e6191e;
    width: 100%;
  }
</style>
